Skip to content

Separate Catch Object - #271

Merged
arcuru merged 2 commits into
exercism:masterfrom
arcuru:catch_object
Apr 21, 2019
Merged

arcuru merged 2 commits into
exercism:masterfrom
arcuru:catch_object

Conversation

@arcuru

@arcuru arcuru commented Apr 20, 2019

Copy link
Copy Markdown
Contributor

This adds a separate compilation object for the Catch main configuration. See https://github.com/catchorg/Catch2/blob/master/docs/slow-compiles.md for an explanation from Catch.

In short, including the Catch header is relatively heavy but not too bad, but most of the compilation time for Catch comes from compiling it with support for main, as that actually causes a compile of the Catch functionality and not just of the interface. By separating this out into it's own object, we ensure that students only need to build the object once per exercise, rather than every time they modify the test.cpp file or their exercise header. This was discussed in the comments of #233.

This also revealed an issue of a missing include in the clock test, which is fixed here.

This was done with the following script:

cd exercises/
ls */*_test.cpp | xargs sed -i '/CATCH_CONFIG_MAIN/d'
ls */CMakeLists.txt | xargs sed -i 's/${file}.h/${file}.h\ test\/tests-main.cpp)/'
for x in *
  echo "#define CATCH_CONFIG_MAIN" >> $x/test/tests-main.cpp
  echo "#include \"catch.hpp\"" >> $x/test/tests-main.cpp
end

@arcuru arcuru mentioned this pull request Apr 20, 2019
@KevinWMatthews

Copy link
Copy Markdown
Contributor

Looks reasonable. Fixes the user experience first in a straightforward fashion.

@arcuru
arcuru merged commit af78f54 into exercism:master Apr 21, 2019
@arcuru
arcuru deleted the catch_object branch April 21, 2019 14:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants